﻿using Abp.AutoMapper;
using Abp.Dependency;
using Abp.Runtime.Session;
using Paas.Core.Approvals.Entities;
using Paas.Core.Const.Enums.Approvals;
using Basefr.App.Dtos;
using Basefr.Runtime.Extensions;
using System;

namespace Paas.App.Interface.Approvals.Dtos
{
    [AutoMap(typeof(ApproveStep))]
    public class ApproveStepDto : DtoBase
    {
        public int ApproveId { get; set; }

        public int TemplateStepId { get; set; }

        public string Name { get; set; }

        public int SortIndex { get; set; }

        public bool OperateByInitiator { get; set; }

        public bool ChangeObjectState { get; set; }


        public int? NextId { get; set; }

        public bool IsCurrent { get; set; }

        public EnumApproveStepState State { get; set; }
        public string StateStr => State.Description();

        public long? OperatorId { get; set; }
        public string OperatorName { get; set; }
        public bool IsStepOperator => OperatorId == IocManager.Instance.Resolve<IAbpSession>().GetUserId();


        public DateTime? OperateTime { get; set; }
        public string OperateTimeStr => OperateTime?.ToString("yyyy-MM-dd HH:mm");

        public string Opinion { get; set; }


        public bool IsLastStep { get; set; }
    }
}

